package javabase.schoolwork.day5_22;

import java.util.Scanner;

/**
 * @author fance
 * @date 2018/5/22 21:25
 */
public class Solution {

     public static void main(String[] args) {
//制作表存放年龄
         String[] table= {"儿童","少年","青少年","少年","壮年","中年","中老年","老年","老老年","老老老年"};
    }
    //数组练习1
    public static void printScoreAndLevel() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入学生个数：");
        int studentNum = scanner.nextInt();
        int[] studentScore = new int[studentNum];
        System.out.println("请输入成绩：");
        for (int i = 0; i < studentNum; i++) {
            studentScore[i] = scanner.nextInt();
        }
        int max = 0;
        for (int i = 0; i < studentNum; i++) {
            max = Math.max(studentScore[i],max);
        }
        for (int i = 0; i < studentNum; i++) {
            System.out.println("student " + i + "score is "+studentScore[i]+" grade is "+getGrade(studentScore[i],max));
        }

    }
    //判断等级
    private static String getGrade(int score,int max) {
        if(score >= max-10) {
            return "A";
        }else if(score >= max-20) {
            return "B";
        }else if(score >= max-30) {
            return "C";
        }else {
            return "D";
        }

    }


    public static int mOL(int a) {
        return a*a;
    }
    public static int mOL(int a,int b) {
        return a*b;
    }
    public static void mOL(String a) {
        System.out.println(a);
    }


    public static void judgeAge(int age) {
        if(age>=0&&age<=9) {
            System.out.println("儿童");
        }else if(age>=10&&age<=19) {
            System.out.println("少年");
        }else if(age>=20&&age<=29) {
            System.out.println("青少年");
        }else if(age>=30&&age<=39) {
            System.out.println("少年");
        }else if(age>=40&&age<=49) {
            System.out.println("壮年");
        }else if(age>=50&&age<=59) {
            System.out.println("中年");
        }else if(age>=60&&age<=69) {
            System.out.println("中老年");
        }else if(age>=70&&age<=79) {
            System.out.println("老年");
        }else if(age>=80&&age<=89) {
            System.out.println("老老年");
        }else if(age>=90&&age<=99) {
            System.out.println("老老老年");
        }
    }

    public static void getAge(int age,String[] table) {
       int index = age / 10;
        System.out.println(table[index]);
    }
}
